<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>欢迎进入caner首页</title>
		<link rel="stylesheet" type="text/css" href="css/index-style.css" />
		<!-- <script type="text/javascript" charset="UTF-8" src="index-js.js"></script>
		<script src="js/bootstrap.min.js" type="text/javascript"></script> -->
		<script src="js/jquery-1.8.3.js" ></script>
		<script type="text/jscript">
		$(document).ready(function(){
			isNull;
			isPasswordRight()
		});
			function isNull(){
				var index_account = $("#index-account").val();
				var index_password = $("#index-password").val();
				if(index_account == "" || index_password == ""){
					// alert(123);
					if(index_account == ""){
						$("#span-account").html("用户名不能为空");
						 return false;
					}else{
						$("#span-account").html("");
					}
					if(index_password == ""){
						$("#span-password").html("密码不能为空");
						 return false;
					}else{
						$("#span-password").html("");
					}
				}else{
					return true;
				}
			}
			
			function isPasswordRight(){
				var username = $("#index-account").val();
				var password =$("#index-password").val();
			    //alert(username);
				if(password != ""){
				$.post(
					"/cn.yl.caner/checkPassword",
					{"password": password , 
					"username" : username},
					function(data){
						var isPassword = data.isPassword;
						if(isPassword == true){
							return true;
						}else{
							return false;
							$("#span-password").html("密码不正确");
						}
						$("#span-password").html("");
					},
					"json"
				);	
				}else{
					return false;
				}
			}
		</script>
	</head>
	<body>
		<div id="index-body">
			<div id="index-header">
				欢迎进入caner系统首页
			</div>
			<div id="index-background">
				<img src="img/index-headSculpture.png" id="index-img">
				<div id="index-form">
					<form method="post" action="/cn.yl.caner/login" onsubmit="return isPasswordRight()">
						<div id="index-input">
							<input type="text" name="account" id="index-account" value="" placeholder="用户名" maxlength="8" /><br/><span id="span-account" style="color: red;"></span>
							<input type="password" name="password" id="index-password" value=""  placeholder="密码"/><br/><span id="span-password" style="color: red;"></span>
						</div>
						<div id="index-loginbutton">
							<table>
								<tr>
									<td><input type="submit" value="登录" class="index-login" onmouseover="this.id='button-color-red'" onmouseout="this.id='button-color-green'" onclick="return isNull()"/></td>
									<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
									<td><a href="registe.jsp" style="text-decoration : none;"><input type="button" value="注册" class="index-login" onmouseover="this.id='button-color-red'" onmouseout="this.id='button-color-green'"/></a></td>
								</tr>
							</table>
						</div>
					</form>
				</div>
			</div>	
		</div>	
		
	</body>
</html>
